<template>
	<view>
		<ttBar title="评价中心" leftIcon="icon-back"></ttBar>
		<view class="jumpBox" @tap="toPage" data-url="myEvaluate">
			<text>全部评价</text>
			<text class="iconfont icon-right"></text>
		</view>
		<scroll-view :scroll-y="true" :style="{'height':scHeight+'px'}" style="background-color: #f6f6f6;" @scrolltolower="getData">
			<view class="list">
				<witeEvaItem v-for="(item,index) in list" :key="index" :orderItem="item"></witeEvaItem>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		mapState,
		mapGetters,
		mapMutation,
		mapActions
	} from "vuex";
	import witeEvaItem from "@/components/orderItem/witeEvaItem.vue";
	export default {
		components:{
			witeEvaItem
		},
		computed:{
			...mapState({
				userInfo:state=>state.user.userInfo,
			})
		},
		data() {
			return {
				
				scHeight:uni.getSystemInfoSync().screenHeight-uni.getSystemInfoSync().statusBarHeight-uni.upx2px(180),
				hasNext:true,
				list:[],
				page_no:1
			};
		},
		methods:{
			getData(){
				if(this.hasNext){
					this.$store.dispatch("apiGetOrderList",{
						userId:this.userInfo.userId,
						status:30,
						page_no:this.page_no,
						page_size:10
					}).then(res=>{
						this.list=this.list.concat(res.data.data.items);
						this.hasNext=res.data.data.hasNext;
						this.page_no=res.data.data.nextPage;
					})
				}else{
					uni.showToast({
						title: '没有更多数据了',
						icon: 'none'
					});
				}
				
			}
		},
		onLoad() {
			this.getData()
		},
		onPullDownRefresh() {
			setTimeout(() => {
				this.page_no=1;
				this.hasNext=true;
				this.list=[];
				this.getData();
				uni.stopPullDownRefresh();
			}, 1500)
		}
	}
</script>

<style lang="less">
	page{
		background-color: #f6f6f6;
	}
	.jumpBox{
		box-sizing: border-box;
		border-top: 1px solid #f6f6f6;
		height: 90upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 32upx;
		background-color: #FFFFFF;
		padding: 0 56upx;
		.iconfont{
			font-size: 40upx;
		}
		
	}
	.list{
		padding: 18upx;
	}
</style>
